Skip to content

Instantly share code, notes, and snippets.

@hugotkk
hugotkk / apache_php.ps1
Created March 20, 2016 09:12
add php extension to apache
write-host "checking..."
# check for apache
$apache = scoop which httpd
if($lastexitcode -ne 0) { 'Apache isn''t installed. run ''scoop install apache'''; return }
# check for php
$php = scoop which php
if($lastexitcode -ne 0) { 'PHP isn''t installed. run ''scoop install php'''; return }
@hugotkk
hugotkk / script.bash
Created March 6, 2018 01:45
generate dummy file
dd if=/dev/zero of=output.dat bs=24M count=1
mkfile 24m output.dat
@hugotkk
hugotkk / j
Last active August 20, 2018 01:29
emacs
(custom-set-variables '(helm-ag-base-command "git --no-pager grep --full-name -n --no-color "))
"ag --nocolor --nogroup"
(setq projectile-indexing-method 'git)
(setq projectile-enable-caching t)
(global-set-key (kbd "C-'") 'ace-jump-buffer)
@hugotkk
hugotkk / convert.sh
Last active September 20, 2018 02:52
Convert PDF to image
convert -density 300 -quality 100 in.pdf out.jpg
@hugotkk
hugotkk / gist:1f1de6ecf99287a6ab73ec1be9b2ba58
Created August 10, 2018 06:18 — forked from michaellouieloria/gist:0ff4376475b68e1e78c2
PDFtk commands to create fdf and fill form
create fdf
pdftk form.pdf generate_fdf output data.fdf
fill form
pdftk form.pdf fill_form data.fdf output form_with_data.pdf
@hugotkk
hugotkk / Howto convert a PFX to a seperate .key & .crt file
Created August 20, 2018 10:15 — forked from TemporaryJam/Howto convert a PFX to a seperate .key & .crt file
How to convert a .pfx SSL certificate to .crt/key (pem) formats. Useful for NGINX
source: http://www.markbrilman.nl/2011/08/howto-convert-a-pfx-to-a-seperate-key-crt-file/
`openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]`
What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when you created your .pfx file. If you cannot remember it anymore you can just throw your .pfx file away, cause you won’t be able to import it again, anywhere!. Once you entered the import password OpenSSL requests you to type in another password, twice!. This new password will protect your .key file.
Now let’s extract the certificate:
`openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]`
@hugotkk
hugotkk / 1.php
Created November 8, 2018 07:57
#twig, #htmlspecialchars, #htmlspecialchars_decode
// Prevent html injection eg: <h1>hihi</h1>
$text = htmlspecialchars($text)
// twig default with prevent the html injection
{{ text }} -> &lt;h1&gt;hihi&lt;/h1&gt;
{{ text | raw }} -> <h1>hihi</h1>
// convert &gt; -> >, does not need unless you want to be hacked with html
htmlspecialchars_decode($text);
@hugotkk
hugotkk / SolrQuerySyntaxPrimer.md
Created October 9, 2020 01:08 — forked from mankyKitty/SolrQuerySyntaxPrimer.md
The documentation around the basics of the Solr query syntax is terrible, this is an attempt to alleviate the doc-shock associated with trying to learn some fundamentals.

Solr Query Syntax Basics

This is a super basic beginners guide to Solr Lucene query syntax. We're going to cover running a straightforward query, as well as some of the more useful functionality such as filtering and creating facets. We'll point out some things you can't do and generally give you enough instruction so that you can get yourself into trouble.

For testing you need a REST client capable of sending requests to your Solr instance. Either RESTClient for Firefox or Postman for Chrome are good choices.

Misc

Request Specific Fields

To specify a list of fields to return instead of the default Solr response use fl and provide a comma delimited list of fields:

@hugotkk
hugotkk / SolrQuerySyntaxPrimer.md
Created October 9, 2020 01:08 — forked from mankyKitty/SolrQuerySyntaxPrimer.md
The documentation around the basics of the Solr query syntax is terrible, this is an attempt to alleviate the doc-shock associated with trying to learn some fundamentals.

Solr Query Syntax Basics

This is a super basic beginners guide to Solr Lucene query syntax. We're going to cover running a straightforward query, as well as some of the more useful functionality such as filtering and creating facets. We'll point out some things you can't do and generally give you enough instruction so that you can get yourself into trouble.

For testing you need a REST client capable of sending requests to your Solr instance. Either RESTClient for Firefox or Postman for Chrome are good choices.

Misc

Request Specific Fields

To specify a list of fields to return instead of the default Solr response use fl and provide a comma delimited list of fields:

Keybase proof

I hereby claim:

  • I am hugotkk on github.
  • I am hugotse (https://keybase.io/hugotse) on keybase.
  • I have a public key ASCOpG0WN_OQX2mpRf-jdMM-m3Wr77s-iilpTXkpZA4rbwo

To claim this, I am signing this object: