Skip to content

Instantly share code, notes, and snippets.

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

Dennis Y. Parygin dyp2000

🏠
Working from home
  • RUSSIA, Yekaterinburg
View GitHub Profile
@jcomellas
jcomellas / netutil.erl
Created February 22, 2011 23:17
Functions to obtain IP addresses from subnets in Erlang.
-module(netutil).
-author('Juan Jose Comellas <juanjo@comellas.org>').
%% API
-export([get_local_ip_from_subnet/1, get_ip_from_subnet/2,
cidr_network/1, cidr_netmask/1]).
%% @type ipv4() = {integer(), integer(), integer(), integer()}
@mk-qi
mk-qi / libcurlpostxml.c
Created May 17, 2012 08:25
c libcurl POST xml
/*
* gcc -lcurl libcurlpostxml.c -o libcurlpostxml
* ./libcurlpostxml
*/
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
@ain
ain / uniqid.js
Created May 23, 2013 19:57
JavaScript alternative of PHP uniqid()
function uniqid (prefix, more_entropy) {
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + revised by: Kankrelune (http://www.webfaktory.info/)
// % note 1: Uses an internal counter (in php_js global) to avoid collision
// * example 1: uniqid();
// * returns 1: 'a30285b160c14'
// * example 2: uniqid('foo');
// * returns 2: 'fooa30285b1cd361'
// * example 3: uniqid('bar', true);
// * returns 3: 'bara20285b23dfd1.31879087'
@vladimirtsyupko
vladimirtsyupko / gist:10964772
Created April 17, 2014 08:32
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
<?php
/**
* Given a URL, normalize that URL.
* @param String URL
* @return String Normalized URL
*/
function normalizeUrl($url)
{
$newUrl = "";
$url = parse_url($url);
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 2, 2024 16:43
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@shadz3rg
shadz3rg / gost_engine.sh
Created October 15, 2018 11:19
Настройка ГОСТ OpenSSL под Ubuntu 18.04
# Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-36-generic x86_64)
# (из коробки) OpenSSL 1.1.0g 2 Nov 2017
# (из коробки) curl 7.58.0 (x86_64-pc-linux-gnu)
# PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
# Компилим GOST-engine
sudo apt install cmake libssl-dev
git clone --branch=openssl_1_1_0 https://github.com/gost-engine/engine.git gost-engine/engine
cd gost-engine/engine
cmake .
@FanchenBao
FanchenBao / my_queue.py
Last active October 24, 2023 04:20
A custom MyQueue class that avoids `NotImplementedError` when calling queue.qsize() method.
from multiprocessing.queues import Queue
import multiprocessing
# The following implementation of custom MyQueue to avoid NotImplementedError
# when calling queue.qsize() in MacOS X comes almost entirely from this github
# discussion: https://github.com/keras-team/autokeras/issues/368
# Necessary modification is made to make the code compatible with Python3.
class SharedCounter(object):
@jfcherng
jfcherng / st4-changelog.md
Last active April 20, 2024 00:25
Sublime Text 4 changelog just because it's not on the official website yet.
#!/usr/bin/env bash
echo -n -e "\033]0;Homebrew Update...\007"
brew -v update
echo "Press any key to continue..."
read -k1 -s
echo "Upgrading..."
brew -v upgrade
echo "Press any key to continue..."