Skip to content

Instantly share code, notes, and snippets.

View jimmysitu's full-sized avatar

Jimmy Situ jimmysitu

  • ZHAOXIN, JMST
  • 1KHujLT4AzQwQKSLEUSbcergqv7fMnQNXA
View GitHub Profile
@smoser
smoser / README.md
Last active October 12, 2020 17:14
ubuntu-auto-install: install a ubuntu image with kvm

Ubuntu Auto Install

This allows user to do automated installation of ubuntu. Provided here a a few different files/scripts for making this easier.

I've used this to verify that d-i kernel and initramfs from -proposed work as shown in bug 1511497.

The provided 'preseed' below can be used as a fully automated installation of ubuntu. Boot with qemu like:

note python web server is useful for this (python -m SimpleHTTPServer 9999)

@martani
martani / gist:1107330
Created July 26, 2011 17:44
nanosleep, usleep, sleep benchmark
void nsleep(long us)
{
struct timespec wait;
//printf("Will sleep for is %ld\n", diff); //This will take extra ~70 microseconds
wait.tv_sec = us / (1000 * 1000);
wait.tv_nsec = (us % (1000 * 1000)) * 1000;
nanosleep(&wait, NULL);
}
# Install bitcoind
## build bitcoind
mkdir -p ~/source; cd ~/source
wget https://github.com/bitcoin/bitcoin/archive/v0.9.2.tar.gz
tar zxvf v0.9.2; cd bitcoin-0.9.2
## open-nodes.org_hub-v0.9.2.patch
wget https://gist.githubusercontent.com/bitkevin/a1b4a556fffce6fc527a/raw/ -O open-nodes.org_hub-v0.9.2.patch
patch -p1 < open-nodes.org_hub-v0.9.2.patch
@anshula
anshula / phoronix-cmd.md
Last active November 6, 2024 11:56
Phoronix Test Suite Cheat Sheet
@micw
micw / install_jenkins_plugin.sh
Last active August 11, 2023 06:14
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "USAGE: $0 plugin1 plugin2 ..."
exit 1
fi
plugin_dir=/var/lib/jenkins/plugins
#!/usr/bin/env python
# coding: utf-8
import json
import sys
import re
from tornado.httputil import url_concat
from tornado.httpclient import AsyncHTTPClient
from tornado.ioloop import IOLoop
@Lucasus
Lucasus / Jenkins plugin dependencies tree fetcher
Last active September 8, 2021 10:18
Fetches names and versions of all dependencies of particular Jenkins Plugin. Useful for automatic plugin installations via DevOps tools like Ansible, when all required plugin dependencies have to be manually installed via Jenkins CLI
// This is app.js file
var request = require("request"),
cheerio = require("cheerio"),
_ = require("lodash");
var foundDependencies = [];
function findDependencies(error, response, body, currentDependency) {
if (error) {
console.log("We’ve encountered an error: " + error);
#!/bin/sh
set -e
write_to () {
echo $2 | sudo tee $1 > /dev/null
}
set_rate () {
c=fclk$1
anonymous
anonymous / morningstar.R
Created December 5, 2016 16:46
How to retrieve data from Morningstar
require(RCurl)
require(jsonlite)
myticker<-"FB"
url.histprice<-function(x){ return(paste0("http://globalquote.morningstar.com/globalcomponent/RealtimeHistoricalStockData.ashx?ticker=",x,"&showVol=true&dtype=his&f=d&curry=USD&range=1900-1-1|2014-10-10&isD=true&isS=true&hasF=true&ProdCode=DIRECT"))}
url.keyratios<-function(x){return(paste0("http://financials.morningstar.com/ajax/exportKR2CSV.html?t=",x))}
#Retrieve historical prices
json.histprice<-getURL(url.histprice(myticker))
json.histprice<-sub("NaN","\"NA\"",json.histprice)
@Era-Dorta
Era-Dorta / create-efi-keys.sh
Last active July 9, 2024 14:08
Sign kernel modules on Ubuntu, useful for Nvidia drivers in UEFI system
# VERY IMPORTANT! After each kernel update or dkms rebuild the modules must be signed again with the script
# ~/.ssl/sign-all-modules.sh
# Place all files in ~/.ssl folder
mkdir ~/.ssl
cd ~/.ssl
# Generate custom keys with openssl
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -subj "/CN=Owner/"