Skip to content

Instantly share code, notes, and snippets.

View nozim's full-sized avatar
🏠
Working from home

Nozim Mehrubonov nozim

🏠
Working from home
View GitHub Profile
@cloakd
cloakd / chrono_idl.json
Last active February 29, 2024 15:19
chrono_idl
{
"version": "0.1.1",
"name": "solana_tribes",
"instructions": [
{
"name": "mintTokens",
"accounts": [
{
"name": "world",
"isMut": false,
@chenxiaolong
chenxiaolong / DellXPS15_9560_AHCI_RAID.md
Created November 27, 2017 01:33
Switching between AHCI and RAID on the Dell XPS 15 (9560)

Switching between AHCI and RAID on the Dell XPS 15 (9560)

This guide likely applies to other models and, potentially, even laptops from other OEMs that have NVME drives. However, I've only tested this on my Dell XPS 15 (9560) with the OEM Windows installation from the Signature Edition model.

Switching from RAID to AHCI

Switching from RAID to AHCI is significantly simpler than switching from AHCI to RAID. All that's needed is a successful boot to Safe Mode.

  1. To set the default boot mode to Safe Mode, use msconfig.exe or open an admin cmd/PowerShell window and run:
@Sonictherocketman
Sonictherocketman / xmpp_oauth_authentication.py
Created October 24, 2017 22:05
Use OAuth tokens as XMPP passwords given an OAuth Provider.
#! /usr/bin/python
# https://docs.ejabberd.im/developer/guide/#toc_8
import sys, os
from struct import *
from requests import get
BASE_URL = os.environ['BASE_URL']
DJANGO_AUTH = os.environ['DJANGO_AUTH']
DJANGO_IS_USER = os.environ['DJANGO_IS_USER']
@wfaler
wfaler / bind-consul.sh
Created September 9, 2015 19:01
use consul as DNS for local services, fronted by Bind for the rest
sudo apt-get install bind9 bind9utils bind9-doc
wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
/etc/bind/named.conf.options:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { localhost; };
forwarders {
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout:
@bendc
bendc / functional-utils.js
Last active September 15, 2023 12:12
A set of pure ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
import com.lmax.disruptor.dsl.Disruptor
import java.util.concurrent.Executors
import com.lmax.disruptor._
case class ValueEvent(var value: Long)
case class ValueEventTranslator(value: Long) extends EventTranslator[ValueEvent] {
def translateTo(event: ValueEvent, sequence: Long) = {
event.value = value
event
@petermanser
petermanser / _gitlab_config.md
Last active September 9, 2016 19:48
Gitlab 5.4 - Gmail configuration

Gitlab 5.4 - Gmail configuration

In order to send messages through a Gmail account (also applicable to Google Apps accounts) add the following parts to your config files:

Files:

  • config/environments/production.rb
  • config/gitlab.yml
@webdesserts
webdesserts / Gulpfile.js
Last active April 3, 2023 08:16
Automatically reload your node.js app on file change with Gulp (https://github.com/wearefractal/gulp).
// NOTE: I previously suggested doing this through Grunt, but had plenty of problems with
// my set up. Grunt did some weird things with scope, and I ended up using nodemon. This
// setup is now using Gulp. It works exactly how I expect it to and is WAY more concise.
var gulp = require('gulp'),
spawn = require('child_process').spawn,
node;
/**
* $ gulp server
* description: launch the server. If there's a server already running, kill it.