Skip to content

Instantly share code, notes, and snippets.

View 345161974's full-sized avatar
🎯
Focusing

Lucas 345161974

🎯
Focusing
View GitHub Profile
@345161974
345161974 / build_sqlite3_lib.md
Created March 19, 2023 13:39 — forked from zeljic/build_sqlite3_lib.md
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source (https://www.sqlite.org/download.html)

    For example: source https://www.sqlite.org/2022/sqlite-amalgamation-3390300.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2022/sqlite-dll-win64-x64-3390300.zip

  3. Extract both archives to the same directory

@345161974
345161974 / zlib_strings.cpp
Created September 14, 2021 07:35 — forked from gomons/zlib_strings.cpp
Compressing STL Strings with zlib
// Copyright 2007 Timo Bingmann <tb@panthema.net>
// Distributed under the Boost Software License, Version 1.0.
// (See http://www.boost.org/LICENSE_1_0.txt)
//
// Original link http://panthema.net/2007/0328-ZLibString.html
#include <string>
#include <stdexcept>
#include <iostream>
#include <iomanip>

To install tcptraceroute on Debian/Ubuntu:

$ sudo apt-get install tcptraceroute

To install tcptraceroute on CentOS/REHL, first set up RepoForge on your system, and then:

$ sudo yum install tcptraceroute
@345161974
345161974 / timespec_diff.c
Created January 18, 2018 07:03 — forked from diabloneo/timespec_diff.c
Calculate diff of two struct timespec
#include <time.h>
void timespec_diff(struct timespec *start, struct timespec *stop,
struct timespec *result)
{
if ((stop->tv_nsec - start->tv_nsec) < 0) {
result->tv_sec = stop->tv_sec - start->tv_sec - 1;
result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
} else {
result->tv_sec = stop->tv_sec - start->tv_sec;
@345161974
345161974 / vue_to_do_list.html
Created December 7, 2017 06:26
Vue.js 2.x ToDoList
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vue.js todo list</title>
<script src="https://unpkg.com/vue"></script>
<style type="text/css">
#box { width: 350px; margin: 30px auto; background: #eee; padding: 30px 50px; }
li { list-style-type: none; }
ul { padding-left: 0; }
@345161974
345161974 / simp_zoom.py
Created December 4, 2017 04:10 — forked from tacaswell/simp_zoom.py
factory for adding zoom callback to matplotlib graphs
import matplotlib.pyplot as plt
def zoom_factory(ax,base_scale = 2.):
def zoom_fun(event):
# get the current x and y limits
cur_xlim = ax.get_xlim()
cur_ylim = ax.get_ylim()
# set the range
cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5
@345161974
345161974 / gist:63573abdf1dc9c303d6740fb29496657
Created August 16, 2017 04:56 — forked from waqasjamal-zz/gist:7428185
Python Code for adding posts to WordPress remotely
import urllib
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods import posts
import xmlrpclib
from wordpress_xmlrpc.compat import xmlrpc_client
from wordpress_xmlrpc.methods import media, posts
import os
########################### Read Me First ###############################
'''
------------------------------------------In DETAIL--------------------------------
@345161974
345161974 / GoMgoSample-1.go
Created June 12, 2017 06:27 — forked from ardan-bkennedy/GoMgoSample-1.go
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {
@345161974
345161974 / mgoExample.go
Created June 4, 2017 09:27 — forked from border/mgoExample.go
mgo example
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@345161974
345161974 / mongo_backup.sh
Created May 16, 2017 08:27 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"