Skip to content

Instantly share code, notes, and snippets.

View abnerCrack's full-sized avatar
🏠
Working.

C abnerCrack

🏠
Working.
View GitHub Profile
git_current_branch () {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
@jakewtaylor
jakewtaylor / usage.jsx
Last active August 31, 2022 18:21
useStyles() React Hook
import React from 'react';
import { useStyles } from '../hooks/useStyles';
export const Sidebar = ({ colourful = false }) => {
const styles = useStyles(stylesheet);
return (
<div className={styles.sidebar}>
<p
className={styles.compose(
@rust-play
rust-play / playground.rs
Created April 3, 2018 08:34
Code shared from the Rust Playground
extern crate openssl;
use openssl::rsa::Rsa;
use openssl::pkey::PKey;
use std::str;
use openssl::x509::{X509, X509Name};
use openssl::hash::MessageDigest;
use openssl::nid::Nid;
fn main() {
@SimonTart
SimonTart / .npmrc
Last active November 19, 2022 09:57
npmrc config for china
registry=https://registry.npm.taobao.org
disturl=https://npm.taobao.org/dist
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/
chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver
operadriver_cdnurl=https://npm.taobao.org/mirrors/operadriver
selenium_cdnurl=https://npm.taobao.org/mirrors/selenium
node_inspector_cdnurl=https://npm.taobao.org/mirrors/node-inspector
fsevents_binary_host_mirror=http://npm.taobao.org/mirrors/fsevents/
@lanedraex
lanedraex / listener.rs
Created November 5, 2017 09:12
Rust UDP socket: send and receive
use std::net;
use std::env;
fn listen(socket: &net::UdpSocket, mut buffer: &mut [u8]) -> usize {
let (number_of_bytes, src_addr) = socket.recv_from(&mut buffer).expect("no data received");
println!("{:?}", number_of_bytes);
println!("{:?}", src_addr);
import WebKit
import UIKit
class WebViewController: UIViewController {
var url: URL!
var wKWebView: WKWebView!
@IBOutlet weak var containerView: UIView!
@IBOutlet weak var goBackButton: UIBarButtonItem!
@IBOutlet weak var goForwardButton: UIBarButtonItem!
@fracasula
fracasula / proxy.js
Last active November 28, 2019 16:12
Node.js basic example for proxy to http server
/**
* Once this is running open your browser and hit http://localhost
* You'll see that the request hits the proxy and you get the HTML back
*/
'use strict';
const net = require('net');
const http = require('http');
@stecman
stecman / GDEPaper.h
Last active June 5, 2024 15:18
Good Display epaper/eink screen testing code - image data from computer over USART
#pragma once
// AVR
extern "C" {
#include <avr/io.h>
}
#define GD_PSR 0x00 // Panel settings
#define GD_PWR 0x01 // Power setting
#define GD_BTST 0x06 // Booster soft start
@Kovrinic
Kovrinic / .gitconfig
Last active May 13, 2025 07:15
git global url insteadOf setup
# one or the other, NOT both
[url "https://github"]
insteadOf = git://github
# or
[url "[email protected]:"]
insteadOf = git://github
@umidjons
umidjons / aes-256-cbc-nodejs-crypto.md
Last active March 13, 2022 07:12
AES-256-CBC example in Node.js using crypto module

AES-256-CBC example in Node.js using crypto module

'use strict';
const crypto = require('crypto');

// get password's md5 hash
let password = 'test';
let password_hash = crypto.createHash('md5').update(password, 'utf-8').digest('hex').toUpperCase();
console.log('key=', password_hash); // 098F6BCD4621D373CADE4E832627B4F6