Skip to content

Instantly share code, notes, and snippets.

View wzulfikar's full-sized avatar
💭
Set status

Wildan Zulfikar wzulfikar

💭
Set status
View GitHub Profile
@djonsson
djonsson / install_elasticsearch_osx.md
Last active November 11, 2022 21:10
OS X installation instructions for Elasticsearch + Kibana + Marvel

What is this?

Following this guide will set up a local Elasticsearch with Kibana and Marvel using Homebrew and Homebrew Cask

Prerequisites

If you already have Java installed on your system, skip steps Install Cask and Install Java

If you already have Java and Homebrew installed on your system, skip steps Prerequisites, start at Install Elasticsearch and Kibana after running $ brew update

Install Homebrew

  • $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@karmi
karmi / .gitignore
Last active November 12, 2022 12:11
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@mischah
mischah / z.md
Last active December 9, 2022 02:11
Installing und initializing z (https://github.com/rupa/z) with help of Homebrew.

#The power of z

Do you spend lots of time doing things like this?

cd this/is/the/path/that/i/want/so/i/type/it/all/out/to/get/whereiwant

With z, you could just do this:

input {
tcp {
port => 5000
type => syslog
}
udp {
port => 5000
type => syslog
}
}
@nandorojo
nandorojo / README.md
Last active December 23, 2022 23:03
Expo + Next.js Query Param state

Expo + Next.js Query Params State 🦦

A typical use-case on web for maintaining React State is your URL's query parameters. It lets users refresh pages & share links without losing their spot in your app.

URL-as-state is especially useful on Next.js, since next/router will re-render your page with shallow navigation.

This gist lets you leverage the power of URL-as-state, while providing a fallback to React state for usage in React Native apps.

It's essentially a replacement for useState.

@jmtsantos
jmtsantos / cockpit.conf
Created November 21, 2017 17:41
Cockpit reverse proxy with nginx 1.13
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server cockpithost:9090;
}
server {
@iffa
iffa / postgis.json
Last active December 30, 2022 06:06
CapRover template for PostGIS
{
"captainVersion": "2",
"documentation": "https://hub.docker.com/r/postgis/postgis",
"displayName": "Postgres with PostGIS",
"description": "PostGIS is a spatial database extender for PostgreSQL object-relational database.",
"dockerCompose": {
"version": "3.3",
"services": {
"$$cap_appname-db": {
"image": "postgis/postgis:$$cap_postgres_version",
@helinwang
helinwang / gostring.md
Last active January 3, 2023 07:50
Call go (or c) code from python with string as argument and string as return value

go code (foo.go) compiled into a shared library and a c header (foo.h) is generated.

For calling go from c, please see here

Arguments

The code below shows two ways of passing string parameter to go function:

  1. Using GoString structure as argument, without making a copy in go code: no conversion to go string needed.
  2. Using c_char_p as argument, making a copy in go code when converting to go string.

When using the first method without the copy, I don't know how python will do the memory management with the pointer passed into go. So the second method is preferred.

@derindutz
derindutz / use-persistent-swr.ts
Last active January 6, 2023 08:11
useSWR with localforage as a persistent cache
import useSWR from '@zeit/swr';
import localForage from 'localforage';
import { ConfigInterface } from '@zeit/swr/dist/src/types';
import { useState, useEffect } from 'react';
export function usePersistentSWR(key: string, fn?: Function, config?: ConfigInterface) {
let handleSuccess;
if (config !== undefined && config.onSuccess !== undefined) {
const { onSuccess } = config;
handleSuccess = (data: any, key: string, config: ConfigInterface) => {
@patik
patik / .bashrc
Last active January 19, 2023 09:02
Bash configure proxy for corporate network
# configure proxy for git while on corporate network
# From https://gist.github.com/garystafford/8196920
function proxy_on(){
# assumes $USERDOMAIN, $USERNAME, $USERDNSDOMAIN
# are existing Windows system-level environment variables
# assumes $PASSWORD, $PROXY_SERVER, $PROXY_PORT
# are existing Windows current user-level environment variables (your user)
# environment variables are UPPERCASE even in git bash