Skip to content

Instantly share code, notes, and snippets.

View yuanfeiz's full-sized avatar

YuanfΞi Zhu yuanfeiz

  • The Homestead Arcology
View GitHub Profile
@buxx
buxx / aiopoc.py
Created July 24, 2018 12:44
aiohttp stream response example
from aiohttp import web
async def handle(request):
response = web.StreamResponse(
status=200,
reason='OK',
headers={'Content-Type': 'text/plain'},
)
await response.prepare(request)
index 54952fc..6d5d168 100644
--- a/libethash-cl/ethash_cl_miner_kernel.cl
+++ b/libethash-cl/ethash_cl_miner_kernel.cl
@@ -277,7 +277,7 @@ __kernel void ethash_search(
for (int i = 0; i < THREADS_PER_HASH; i++)
{
// share init with other threads
- if (i == thread_id)
+ if ((uint) i == thread_id)
copy(share[hash_id].ulongs, state, 8);
@wkwiatek
wkwiatek / app-1.spec.ts
Last active December 17, 2021 01:52
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
@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
@rtgibbons
rtgibbons / logger.js
Created November 7, 2013 13:51
Logger Library with winston
var app = require(process.cwd() + '/app');
var winston = require('winston');
var _ = require('lodash');
// Set up logger
var customColors = {
trace: 'white',
debug: 'green',
info: 'green',
warn: 'yellow',
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active June 10, 2024 15:37
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@romanbsd
romanbsd / gzip.rb
Created October 15, 2012 13:11
Faraday gzip response middleware
require 'faraday'
require 'zlib'
module FaradayMiddleware
class Gzip < Faraday::Response::Middleware
def on_complete(env)
encoding = env[:response_headers]['content-encoding'].to_s.downcase
case encoding
when 'gzip'
@lg0
lg0 / gist:3490009
Created August 27, 2012 16:19
Toggle VPN on/off and add/clean vpn routes
on vpnToggle(vpnName)
tell application "System Events"
tell current location of network preferences
set VPNservice to service vpnName
set isConnected to connected of current configuration of VPNservice
if isConnected then
disconnect VPNservice
do shell script "./ip-down" with administrator privileges
else
do shell script "./ip-up" with administrator privileges
@vuk-nikolic
vuk-nikolic / ssid-finder.m
Created May 7, 2012 08:46
How to get current SSID (iOS)
#import <SystemConfiguration/CaptiveNetwork.h>
NSString *currentSSID = @"";
CFArrayRef myArray = CNCopySupportedInterfaces();
if (myArray != nil){
NSDictionary* myDict = (NSDictionary *) CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
if (myDict!=nil){
currentSSID=[myDict valueForKey:@"SSID"];
} else {
currentSSID=@"<<NONE>>";
@yuanfeiz
yuanfeiz / xunlei_cloudplayer.js
Created January 9, 2012 16:22
unlimited cloudplayer
javascript:void((function(){var e=document.createElement('script');e.setAttribute('src','http://xlxx.sinaapp.com/xlvod.js');document.body.appendChild(e);})())