Skip to content

Instantly share code, notes, and snippets.

@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active October 17, 2024 23:17
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@thangdc94
thangdc94 / daemon.sh
Last active December 3, 2019 02:01
Deploy service
#!/usr/bin/env bash
waitForProcessEnd() {
pidKilled=$1
processedAt=`date +%s`
while kill -0 ${pidKilled} > /dev/null 2>&1;
do
echo -n "."
sleep 1;
if [ $(( `date +%s` - $processedAt )) -gt 60 ]; then
@dvirsky
dvirsky / crc16_slottable.h
Last active July 21, 2024 19:50
A table of the shortest possible alphanumeric string that is mapped by redis' crc16 to any given cluster slot. the
#ifndef _CRC16_TABLE_H__
#define _CRC16_TABLE_H__
/* A table of the shortest possible alphanumeric string that is mapped by redis' crc16
* to any given redis cluster slot.
*
* The array indexes are slot numbers, so that given a desired slot, this string is guaranteed
* to make redis cluster route a request to the shard holding this slot
*/
@footballqq
footballqq / pycharm python file header
Last active July 8, 2023 20:47
pycharm python file header
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
#@Filename : ${NAME}
#@Date : ${YEAR}-${MONTH}-${DAY}-${HOUR}-${MINUTE}
#@Project: ${PROJECT_NAME}
#@AUTHOR : footballqq
@jeteon
jeteon / google-maps-data-parser.js
Last active March 20, 2025 13:51
NodeJS script to parse the Google Maps "data" URL attribute into an array.
'use strict';
/**
* Basic code to parse the values in the "data" attribute in a Google Maps URL to an Array.
* There will likely still be some work to do to interpret the resulting Array.
*
* Based on information from:
* http://stackoverflow.com/a/34275131/1852838
* http://stackoverflow.com/a/24662610/1852838
*/
@allanwax
allanwax / ClusterScanner
Created August 7, 2015 23:18
Scan a redis cluster in parallel
package com.findology.util.jediscluster;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import redis.clients.jedis.*;
import java.net.InetAddress;
import java.util.*;
import java.util.concurrent.Callable;
@dannguyen
dannguyen / wget-snapshotpage.md
Last active October 15, 2024 22:18
Use wget to snapshot a page and its necessary visual dependencies

Use wget to mirror a single page and its visible dependencies (images, styles)

Money graphic via State of Florida CFO Vendor Payment Search

Graphic via State of Florida CFO Vendor Payment Search (flair.myfloridacfo.com)

This is a quick command I use to snapshot webpages that have a fun image I want to keep for my own collection of WTFViz. Why not just right-click and save the image? Oftentimes, the webpage in which the image is embedded contains necessary context, such as captions and links to important documentation just incase you forget what exactly that fun graphic was trying to explain.

@mareksuscak
mareksuscak / bump-version.sh
Created March 15, 2015 12:56
Bump version shell script.
#!/bin/bash
# Thanks goes to @pete-otaqui for the initial gist:
# https://gist.github.com/pete-otaqui/4188238
#
# Original version modified by Marek Suscak
#
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3" or even "1.2.3-beta+001.ab"
@pseudomuto
pseudomuto / list.c
Created August 25, 2013 16:30
Blog Code: Implementing a Generic Linked List in C
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "list.h"
void list_new(list *list, int elementSize, freeFunction freeFn)
{
assert(elementSize > 0);
list->logicalLength = 0;
@joshdholtz
joshdholtz / SomeFragment.java
Last active December 22, 2022 09:41
Android Google Maps V2 - MapView in XML
public class SomeFragment extends Fragment {
MapView mapView;
GoogleMap map;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.some_layout, container, false);