Skip to content

Instantly share code, notes, and snippets.

@citruz
citruz / QEMU_ON_M1.md
Last active April 17, 2024 15:25
Create Ubuntu and Windows VMs with QEMU on Apple Silicon

Running Linux and Windows on M1 with QEMU

30.11.2020: Updated with the new patchseries and instructions for Windows

02.12.2020: Added tweaks

08.12.2020: Updated with patchseries v4

31.01.2020: Updated with patchseries v6

@mayneyao
mayneyao / notion2blog.js
Last active February 29, 2024 18:01
Notion.so > Personal Blog | custom domain + disqus comment
const MY_DOMAIN = "agodrich.com"
const START_PAGE = "https://www.notion.so/gatsby-starter-notion-2c5e3d685aa341088d4cd8daca52fcc2"
const DISQUS_SHORTNAME = "agodrich"
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
@QuantBits
QuantBits / script.js
Created February 8, 2019 17:55
BitMex USD Converter - For TemperMonkey
// ==UserScript==
// @name BitMex USD Converter
// @namespace https://bitmex.com/
// @version 0.11
// @description Get some sanity into your gambling.
// @author koinkraft
// @grant none
// @include https://bitmex.com/*
// @include https://www.bitmex.com/*
// @require https://code.jquery.com/jquery-2.1.4.min.js
@mrw34
mrw34 / postgres.sh
Last active March 26, 2024 00:24
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) = Linux && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@cboettig
cboettig / docker-compose.yml
Last active December 31, 2023 15:23
debugging NGINX configuration for Jupyter
jupyter:
image: jupyter/datascience-notebook
environment:
- PASSWORD=${PASSWORD}
nginx:
image: nginx
links:
- jupyter
@jordanbaucke
jordanbaucke / bitfinex-python.py
Created June 19, 2013 06:16
Python example code for an authenticated call to Bitfinex API v1
import requests # pip install requests
import json
import base64
import hashlib
import time #for nonce
api_key = ''
api_secret = ''
#url = 'https://bitfinex.com/api/v1/order/new'
@cdwilson
cdwilson / setup_apc_ups.sh
Created July 7, 2012 19:55
Setup APC USB UPS on Ubuntu
#!/bin/sh
# https://help.ubuntu.com/community/apcupsd
# don't actually run this
exit 0
# install apcupsd
sudo apt-get -y install apache2 apcupsd apcupsd-cgi
@juniorz
juniorz / import.rb
Created January 5, 2012 10:15 — forked from ngauthier/import.rb
Import a blogger archive to jekyll (octopress version)
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@lucifr
lucifr / Code added to _config.yml
Created December 2, 2011 04:41
Flickr aside for Octopress
# Flick Badges
# Find your user id here: http://idgettr.com/ It should be something like "25711589%40N00".
flickr_user: 25711589%40N00
flickr_count: 6
@zellux
zellux / migrate.rb
Created November 29, 2011 03:10
Migrate from wordpress to octopress
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'time'
require 'ya2yaml'
require File.join(File.dirname(__FILE__), "downmark_it")
require 'nokogiri'
require 'cgi'