Skip to content

Instantly share code, notes, and snippets.

View kanglicheng's full-sized avatar
🦜
LLMs ftw

Kang-Li (Stephen) Cheng kanglicheng

🦜
LLMs ftw
View GitHub Profile
@kanglicheng
kanglicheng / postgres-brew.md
Created June 27, 2019 20:59 — forked from sgnl/postgres-brew.md
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@kanglicheng
kanglicheng / postgres-brew.md
Created June 27, 2019 21:16 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@kanglicheng
kanglicheng / postgres_slave_promote.md
Created June 28, 2019 03:12 — forked from bartek/postgres_slave_promote.md
What to do when promoting a postgresql slave to master

This example is based on having a cascading setup, where you have a single master, a single "primary" slave, and cascading slaves which are being replicated from the primary slave. For an example of this setup, check out http://bartek.im/blog/2012/12/04/postgresql-92-streaming-primer.html

On the existing master, if accessible, stop postgres.

$ sudo service postgresql stop

And better to be safe than sorry. We can't have two masters running. (I only use this in an automated script. If you're doing this manually, you'd know if it was shutoff)

$ kill -9 `sudo cat /var/lib/postgresql/9.2/main/postmaster.pid | head -n 1` &> /dev/null
class Solution:
def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
output= []
self.gen_subsets(sorted(nums),0,[],output)
return output
def gen_subsets(self,a,i,sofar,output):
n = len(a)
if i==n:
@kanglicheng
kanglicheng / access.sql
Created July 24, 2019 02:14 — forked from a30001539/access.sql
add uer to DB
EXEC sp_addrolemember db_datawriter,[[email protected]]
EXEC sp_addrolemember db_datareader,[[email protected]]
GRANT EXECUTE on SCHEMA :: etl to [[email protected]]
GRANT EXECUTE on DATABASE :: edpdevdb to [[email protected]]
GRANT EXECUTE on SCHEMA :: "external" to [[email protected]]
GRANT EXECUTE on SCHEMA :: staging to [[email protected]]
GRANT CREATE PROCEDURE on DATABASE :: edpdevdb to [[email protected]]
GRANT CREATE TABLE on DATABASE :: edpdevdb to [[email protected]]
GRANT ALTER ANY EXTERNAL FILE FORMAT to [[email protected]]
GRANT ALTER ANY EXTERNAL DATA SOURCE to [[email protected]]
https://repl.it/@martellinick/text-normalizer-drill
https://repl.it/@martellinick/shouter-drill
https://repl.it/@martellinick/Wiseperson-generator-drill
@kanglicheng
kanglicheng / 1.RegistrySnapshot.xml
Created July 24, 2019 02:14
mssyncframework21-corecomponents-x64 v2.1.1648.0 - Passed - Package Tests Results
<?xml version="1.0" encoding="utf-8"?>
<registrySnapshot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<user>S-1-5-21-1953236517-242735908-2433092285-500</user>
<keys>
<key installerType="Msi" displayName="Microsoft Sync Framework 2.1 Core Components (x64) ENU " displayVersion="2.1.1648.0">
<RegistryView>Registry64</RegistryView>
<KeyPath>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{A4E269C1-168D-40D3-9ABD-57FE4D4DB537}</KeyPath>
<DefaultValue />
<InstallLocation><![CDATA[]]></InstallLocation>
<UninstallString><![CDATA[MsiExec.exe /I{A4E269C1-168D-40D3-9ABD-57FE4D4DB537}]]></UninstallString>
@kanglicheng
kanglicheng / Webstorm
Created July 24, 2019 02:14 — forked from BertiKarsunke/Webstorm
[IDE] Jetbrain
//deployment exclued path
.svn;.cvs;.idea;.DS_Store;.git;.hg;*.hprof;*.pyc;node_modules;package-lock.json
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kanglicheng
kanglicheng / Classes1A_Item.cs
Created July 24, 2019 02:14 — forked from vjgrayman/Classes1A_Item.cs
[CSharpSurviver_5]#CSharp
// vim: syntax=CSharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Item
{
[SerializeField]