Skip to content

Instantly share code, notes, and snippets.

View fcicq's full-sized avatar

fcicq fcicq

View GitHub Profile
@thde
thde / alpine-install.sh
Last active February 23, 2024 22:59
A script to install alpine linux on a dedicated server. Tested on Hetzner, Kimsufi / OVH
#!/bin/sh
set -ex
PATH=/bin:/sbin:/usr/bin:/usr/sbin
KEYMAP="us us"
HOST=alpine
USER=anon
ROOT_FS=ext4
BOOT_FS=ext4
@maddouri
maddouri / build-static-python.sh
Created December 6, 2015 22:42
A simple script that builds static versions of Python and LibPython using musl-libc
#!/bin/bash
# set -eux
# This a simple script that builds static versions of Python and LibPython using musl-libc
# Find the associated article at: http://general-purpose.io/2015/12/06/compiling-python-and-libpython-statically-using-musl-libc/
WORKING_DIR="/code/static-python"
MUSL_PREFIX="/code/static-python/musl"
PY_PREFIX="/code/static-python/python"
@john-clark
john-clark / Convert-WindowsImage.ps1
Created August 17, 2015 20:22
deplyment powershell scripts found on the internets
Function
Convert-WindowsImage
{
<#
.NOTES
Copyright (c) Microsoft Corporation. All rights reserved.
Use of this sample source code is subject to the terms of the Microsoft
license agreement under which you licensed this sample source code. If
@Jxck
Jxck / tfo-client.py
Created December 8, 2013 09:09
TCP Fast Open – Webを速くするためにGoogleがやっていること Make the Web Faster 4 - Python サンプルコード
import sys, socket
'''
tcp fast open server sample code
execute it before enable tfo flag
$ echo 3 | sudo tee /proc/sys/net/ipv4/tcp_fastopen
'''
PORT = 80
MSG_FASTOPEN = 0x20000000
@plentz
plentz / nginx.conf
Last active May 10, 2024 03:20
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@mattconnolly
mattconnolly / gist:6444557
Created September 5, 2013 00:27
Using zonecfg to set qemu_extra_opts in SmartOS
# zonecfg -z <uuid>
# add attr
# set name=qemu-extra-opts
# set type=string
# set value="LXNtcCBjcHVzPTEsY29yZXM9NCx0aHJlYWRzPTI="
# end
# commit
# exit
Then reboot the machine. The value is the base64 encoded string that will be added to the qemu-kvm options. The above is "-smp cpus=1,cores=4,threads=2", which plays nice with Windows which for some stupid reason only supports 2 cpus.
@kokjo
kokjo / bitcoin.py
Created May 19, 2013 18:47
Simple and short bitcoind jsonrpc api access.
import jsonrpc
from jsonrpc import ServiceProxy
from os.path import expanduser
conf = {p[0]: p[1].strip() for p in
(l.split("=", 1) for l in open(expanduser("~/.bitcoin/bitcoin.conf")))
if len(p) == 2}
proxy = ServiceProxy("http://%(rpcuser)s:%(rpcpassword)s@127.0.0.1:8332"%conf)
info = proxy.getinfo()
@fnichol
fnichol / smartos-virtio-windows-xp.sh
Created November 17, 2012 18:37
SmartOS: Installing Windows XP With virtio Disk Support
#!/usr/bin/env bash
set -e
if [ -z "$iso" ] ; then
printf -- ">>> You must invoke with iso=/path/to/winxp.iso $(basename $0)\n"
exit 1
fi
if [ -z "$url" ] ; then
#include <algorithm>
#include <cmath>
#include <functional>
#include <numeric>
#include <unordered_map>
#include <vector>
#include <stdint.h>
#include <stdio.h>
using namespace std;
@binux
binux / rewrite.py
Created September 7, 2012 04:25
web proxy http links rewrite
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<17175297.hk@gmail.com>
# http://binux.me
# Created on 2012-09-06 22:22:21
import urlparse
import re