Skip to content

Instantly share code, notes, and snippets.

@jcataluna
jcataluna / gist:1dc2f31694a1c301ab34dac9ccb385ea
Created July 8, 2016 17:23
Script to save all images from a docker-compose.yml file
#!/bin/bash
mkdir -p out
for img in `grep image $1| sed -e 's/^.*image\: //g'`;
do
cleanname=${img/\//-}
tag=`docker images | grep $img | awk '{print $2}'`
echo "Exporting image: $img, tag:$tag ($cleanname)..."
docker save $img -o out/$cleanname.tar
@imneonizer
imneonizer / how-to-download-from-pan-baidu.md
Last active March 20, 2025 02:41
How to download from pan.baidu without account

How to download from pan.baidu.com

Update: https://baidu.kinh.cc is no longer working, Please use https://baidu.erranium.com for limited free downloads and paid downloads.


Disclaimer:

  • This methods uses a 3rd party website: https://baidu.kinh.cc/.
  • I don't know chinese and after one day of searching for a method I finally found this. I don't know how safe this website is but it does the job.
  • Do it on your own responsibility. I have no idea about possible copyright (if there is such a thing in China) and other stuff regarding to this.
@mikofski
mikofski / solarPosition.m
Last active March 20, 2025 02:40
solar position calculator
function [angles,projection] = solarPosition(datetime,latitude,longitude,time_zone,rotation,dst)
%SOLARPOSITION Calculate solar position using most basic algorithm
% This is the most basic algorithm. It is documented in Seinfeld &
% Pandis, Duffie & Beckman and Wikipedia.
%
% [ANGLES,PROJECTION] = SOLARPOSITION(DATE,TIME,LATITUDE,LONGITUDE,TIME_ZONE)
% returns ZENITH & AZIMUTH for all DATE & TIME pairs at LATITUDE, LONGITUDE.
% ANGLES = [ZENITH,AZIMUTH] and PROJECTION = [PHI_X, PHI_Y]
% PHI_X is projection on x-z plane & PHI_Y is projection on y-z plane.
% DATETIME can be string, vector [YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS],
@thiloplanz
thiloplanz / Zero_knowledge_db.md
Last active March 20, 2025 02:40
Zero-knowledge databases

Zero knowledge databases

The idea

The idea is to provide a database as a service to end users in such a way that no one except the user herself can access the data, not even the hosting provider or the database administrator.

Advantages

  • A privacy- and/or security-conscious user will have more trust in such a setup.
  • The service provider cannot be coerced to release the data they were trusted with, and he cannot be held responsible for the content he is storing.
@Baldomo
Baldomo / solar.rs
Last active March 20, 2025 02:41
Sun position calculation utility in Rust
//! This file is a copy of [solar.c](https://github.com/jonls/redshift/blob/master/src/solar.c) from redshift.
//!
//! This module makes extensive use of the [Julian Day notation](https://en.wikipedia.org/wiki/Julian_day)
//! to measure elapsed days between events and in calculations.
use std::collections::HashMap;
/* Ported from javascript code by U.S. Department of Commerce,
National Oceanic & Atmospheric Administration:
http://www.srrb.noaa.gov/highlights/sunrise/calcdetails.html
It is based on equations from "Astronomical Algorithms" by
@truemogician
truemogician / upgrading_postgresql_in_windows.md
Last active March 20, 2025 02:40
Upgrading PostgreSQL in Windows

Upgrading PostgreSQL in Windows

The official documentation for PostgreSQL provides a guide to upgrading using pg_upgrade. However, it can be a bit like a treasure hunt with hidden traps. This gist will walk you through a clear and robust method for upgrading PostgreSQL on Windows, using the upgrade from version 14 to 16 as an example.

1. Install the New Version of PostgreSQL

Before you embark on the upgrade journey, make sure you have the new version installed. This is because the pg_upgrade utility used during the upgrade process belongs to the newer version.

To get started, visit the official download page, download the installer, and run it. A word of caution: do not overwrite the old installation, as you'll need its binaries and data for the upgrade.

@jgomezdans
jgomezdans / sun_position.py
Created December 8, 2010 19:12
Finding the position of the sun
def sun_position ( date, hour, longitude, latitude ):
"""
Calculates the position of the sun given a position and time.
Basically, all you need to know is here:
http://answers.google.com/answers/threadview/id/782886.html
"""
import time
from math import sin, cos, degrees, radians, acos
doy = int ( time.strftime( "%j", time.strptime( date, "%Y-%m-%d" ) ) )
@jwbee
jwbee / jq.md
Last active March 20, 2025 02:39
Make Ubuntu packages 90% faster by rebuilding them

Make Ubuntu packages 90% faster by rebuilding them

TL;DR

You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.

Setting

I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is

@jlia0
jlia0 / agent loop
Last active March 20, 2025 02:37
Manus tools and prompts
You are Manus, an AI agent created by the Manus team.
You excel at the following tasks:
1. Information gathering, fact-checking, and documentation
2. Data processing, analysis, and visualization
3. Writing multi-chapter articles and in-depth research reports
4. Creating websites, applications, and tools
5. Using programming to solve various problems beyond development
6. Various tasks that can be accomplished using computers and the internet
@kjordahl
kjordahl / garradd.py
Created February 26, 2012 17:31
Calculate position of Comet Garradd
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
"""Calculate position for comet Garradd
Author: Kelsey Jordahl
Time-stamp: <Sun Feb 26 12:28:17 EST 2012>
License: GPLv3
"""
import ephem